package luccy.util;

import java.util.Enumeration;
import java.util.Iterator;

public class EnumerationIterator<E> implements Iterator<E> {

    private Enumeration enumeration = null;

    public EnumerationIterator(final Enumeration e) {
        if (e == null) {
            throw new NullPointerException("Enumeration");
        }
        this.enumeration = e;
    }

    public void remove() {
        throw new UnsupportedOperationException("remove");
    }

    public boolean hasNext() {
        return enumeration.hasMoreElements();
    }

    @SuppressWarnings("unchecked")
	public E next() {
        return (E) enumeration.nextElement();
    }

}
